package com.example.yin.service.impl;

import com.example.yin.dao.HistoryMapper;
import com.example.yin.domain.History;
import com.example.yin.service.HistoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;


@Service
public class HistoryServiceImpl implements HistoryService {

    @Autowired
    private HistoryMapper historyMapper;

    @Override
    public boolean vertify(Integer songId, Integer userId) {
        return historyMapper.selectByPrimaryKey(userId,songId)!=null;
    }

    @Override
    public boolean update(History history) {
        return historyMapper.updateByPrimaryKey(history)>0;
    }

    @Override
    public boolean insert(History history) {
        return historyMapper.insertSelective(history)>0;
    }

    @Override
    public List<History> getHisotrybyuserId(Integer userId,Integer orderBy) {
        return historyMapper.getHistorybyUserId(userId,orderBy);
    }

}
